<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="客户名称" prop="customerName">
        <el-input
          v-model="queryParams.customerName"
          placeholder="请输入客户名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="合同编号" prop="code">
        <el-input
          v-model="queryParams.code"
          placeholder="请输入合同编号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="合同名称" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入合同名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
       <el-form-item label="合同状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择合同状态" clearable size="small">
           <el-option
                v-for="dict in opStatusOptions"
                :key="dict.dictValue"
                :label="dict.dictLabel"
                :value="dict.dictValue"
              />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
      <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
              <el-button
                plain
                type="primary"
                icon="el-icon-plus"
                size="mini"
                @click="handleAdd"
                v-hasPermi="['crm:contract:add']"
              >新增合同</el-button>
            </el-col>
            <!-- <el-col :span="1.5">
              <el-button
                type="success"
                icon="el-icon-edit"
                size="mini"
                :disabled="single"
               
                v-hasPermi="['crm:contract:edit']"
              >编辑</el-button>
            </el-col> -->
            <el-col :span="1.5">
              <el-button
                plain
                type="danger"
                icon="el-icon-delete"
                size="mini"
                :disabled="multiple"
                @click="handleDelete"
                v-hasPermi="['crm:contract:remove']"
              >删除</el-button>
            </el-col>
             
          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
          </el-row>
    <el-table v-loading="loading" :data="contractList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column fixed label="合同编号" align="center" prop="code" />
     <el-table-column label="合同名称" align="center" prop="name" width="150px">
     </el-table-column>
     <el-table-column label="合同金额" align="center" prop="money" width="120px">
        <template slot-scope="scope">
          <span class="money">{{formatMoney(scope.row.money,',')}}</span>
        </template>
    </el-table-column>
     <el-table-column label="客户名称" align="center" prop="customerName" :show-overflow-tooltip="true">
       <template slot-scope="scope">
           <el-link @click="openCustomer(scope.row)" :underline="false" type="primary" >{{scope.row.customerName}}</el-link>
        </template>
     </el-table-column>
    <el-table-column label="下单时间" align="center" prop="orderDate" width="180">
      <template slot-scope="scope">
        <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
      </template>
    </el-table-column>
    
    <el-table-column label="合同开始时间" align="center" prop="startTime" width="180">
      <template slot-scope="scope">
        <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
      </template>
    </el-table-column>
    <el-table-column label="合同结束时间" align="center" prop="limitTime" width="180">
      <template slot-scope="scope">
        <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
      </template>
    </el-table-column>
     <el-table-column label="营销积分" align="center" prop="integral" >
      <template slot-scope="scope">
        <span>{{ scope.row.integral}}</span>
      </template>
    </el-table-column>
    <el-table-column label="提成" align="center" prop="rate" >
      <template slot-scope="scope">
        <span>{{ scope.row.rate}}</span>
      </template>
    </el-table-column>
     <!-- <el-table-column label="客户签约人" align="center" prop="customerName" /> -->
     <el-table-column label="备注" align="center" prop="remark" />
     <el-table-column label="负责人" align="center" prop="nickName" />
      <el-table-column label="审核状态" align="center" prop="checkStatus" >
        <template slot-scope="scope">
              <el-tag prop="checkStatus" v-for="(item, index) in statusOptions"  :type="scope.row.checkStatus==1?'success':'danger'"  v-if="scope.row.checkStatus==item.dictValue">{{item.dictLabel}}</el-tag>
          </template>
      </el-table-column>
      <el-table-column label="合同状态" align="center" prop="status" >
        <template slot-scope="scope">
              <el-tag prop="status" v-for="(item, index) in opStatusOptions"  :type="scope.row.status==1?'success':'danger'"  v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
          </template>
      </el-table-column>
      <el-table-column label="审核人" align="center" prop="auditNickName" />
      <el-table-column label="审核时间" align="center" prop="auditTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.auditTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审核意见" align="center" prop="auditNote" />
      <el-table-column  label="操作" align="center" class-name="small-padding fixed-width"  fixed="right" width="140">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-log"
            @click="handleShow(scope.row)"
            v-hasPermi="['crm:contract:query']"
          >查看</el-button>
          <el-button
          v-if="scope.row.checkStatus==1"
              size="mini"
              type="text"
              icon="el-icon-log"
              @click="handleAddReceivables(scope.row)"
              v-hasPermi="['crm:receivables:add']"
            >回款</el-button>
           <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleEditRate(scope.row)"
            v-hasPermi="['crm:contract:editRate']"
          >修改折算系数</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <el-dialog :title="opTitle" :visible.sync="opOpen" width="800px" append-to-body>
        <el-form ref="opform" :model="opform" :rules="oprules" label-width="120px">
          <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="合同编号" prop="code" >
              <el-input v-model="opform.code"   placeholder="请输入合同编号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同名称" prop="name" >
              <el-input v-model="opform.name" maxlength="100" show-word-limit placeholder="请输入合同编号" />
            </el-form-item>
          </el-col>
          </el-row>
            <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="客户名称" prop="customerId" >
                <el-select v-model="opform.customerUserId" placeholder="请选择" style="width:100%" @change="customerSelectChange">
                    <el-option
                    v-for="item in customerUsers"
                    :key="item.customerUserId"
                    :label="item.customerName"
                    :value="item.customerUserId"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="合同金额" prop="money" >
                <el-input v-model="opform.money" type="number"  placeholder="请输入合同金额" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="下单时间" prop="orderDate" >
                  <el-date-picker style="width:100%"
                  v-model="opform.orderDate"
                  type="date"
                  placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="客户签约人" prop="contactsId" >
                <el-select v-model="opform.contactsId" placeholder="请选择" style="width:100%">
                  <el-option
                    v-for="item in contacts"
                    :key="item.contactsId"
                    :label="item.name"
                    :value="item.contactsId"
                  />
                </el-select>
                
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <!-- <el-col :span="12">
              <el-form-item label="公司签约人" prop="companyUserId" >
                  <el-select v-model="opform.companyUserId" placeholder="请选择" style="width:100%">
                </el-select>
              </el-form-item>
            </el-col> -->
            <el-col :span="12">
              <el-form-item label="合同类型" prop="types" >
                  <el-select v-model="opform.types" placeholder="请选择" style="width:100%">
                      <el-option
                        v-for="item in contractTypeOptions"
                        :key="item.dictValue"
                        :label="item.dictLabel"
                        :value="item.dictValue"
                      />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
            <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="合同开始时间" prop="startTime" >
                  <el-date-picker
                  style="width:100%"
                  v-model="opform.startTime"
                  type="date"
                  placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="合同结束时间" prop="limitTime" >
                <el-date-picker
                style="width:100%"
                  v-model="opform.limitTime"
                  type="date"
                  placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="24">
              <el-form-item label="备注"   >
                <el-input type="textarea" v-model="opform.remark" maxlength="100" show-word-limit placeholder="请输入备注" />
              </el-form-item>
            </el-col>
          </el-row>
          <h3>产品 </h3>
          <el-button
              type="primary"
              icon="el-icon-plus"
              size="mini"
              @click="openProduct"
            >添加产品</el-button>
          <el-row style="margin-top:10px;">
            <el-col :span="24">
            <el-table
              :data="contractProducts"
              border
              style="width: 100%">
              <el-table-column
                fixed
                prop="name"
                label="产品名称"
                width="150">
              </el-table-column>
              <el-table-column
                prop="cateName"
                label="类别"
                width="120">
              </el-table-column>
              <el-table-column
                prop="unit"
                label="单位"
                width="120">
              </el-table-column>
              <el-table-column
                prop="price"
                label="单价"
                width="120">
              </el-table-column>
              <el-table-column
                prop="salesPrice"
                label="售价"
                width="150">
                  <template slot-scope="scope">
                  <el-input v-model="scope.row.salesPrice"  @change="priceChange(scope.row)" type="number" ></el-input>
                </template>
              </el-table-column>
              <el-table-column
                prop="num"
                label="数量"
                width="100">
                  <template slot-scope="scope">
                  <el-input  v-model="scope.row.num" type="number"  @change="numberChange(scope.row)"></el-input>
                </template>
                  
              </el-table-column>
              <el-table-column
                prop="discount"
                label="折扣"
                width="100">
                  <template slot-scope="scope">
                  <el-input v-model="scope.row.discount" @change="discountChange(scope.row)"  type="number" ></el-input>
                </template>
              </el-table-column>
              <el-table-column
                prop="subtotal"
                label="小计"
                width="120">
              </el-table-column>
              <el-table-column
                fixed="right"
                label="操作"
                width="100">
                <template slot-scope="scope">
                  <el-button  type="text" size="small" @click="delProduct(scope.row)">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
            
          </el-col>
          </el-row>
          <div style="float:right;margin:10px;">
              已选中产品： {{contractProducts.length}}   总金额：￥  <span>{{opform.totalPrice}}</span>
          </div>
        </el-form>
          <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="addSubmitForm" >确 定</el-button>
        
        </div>
    </el-dialog>
    <el-drawer
     size="50%"
     :with-header="false"
      :title="customerShow.title" :visible.sync="customerShow.open"
      >
        <customer  ref="customer" />
    </el-drawer>
    <el-drawer
     size="50%"
     :with-header="false"
      :title="contractShow.title" :visible.sync="contractShow.open"
      >
        <contract  ref="contract" />
    </el-drawer>
    <el-dialog :title="product.title" :visible.sync="product.open" width="650px" append-to-body>
      <product  ref="product" @update-product="updateProduct" />
    </el-dialog>
    <el-dialog :title="editRate.title" :visible.sync="editRate.open" width="400px" append-to-body>
       <el-form ref="editRateform" :model="editRateform" :rules="editRateRules" label-width="120px">
          <el-row >
          <el-col :span="24">
            <el-form-item label="折算系数%" prop="rate" >
              <el-input v-model="editRateform.rate"   placeholder="请输入折算系数" />
            </el-form-item>
          </el-col>
         
          </el-row>
       </el-form>
         <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="editRateSubmitForm" >确 定</el-button>
        
        </div>
    </el-dialog>
     <el-dialog :title="receivable.title" :visible.sync="receivable.open" width="500px" append-to-body>
      <el-form ref="receivableform" :model="receivableform" :rules="receivablerules" label-width="80px">
        <el-form-item label="回款编号" prop="code">
          <el-input v-model="receivableform.code" placeholder="请输入回款编号" />
        </el-form-item>
         <el-form-item label="合同名称" prop="name">
          <el-input v-model="receivableform.name" :disabled="true" style="width: 220px"   />
        </el-form-item>
        <el-form-item label="客户" prop="customerName">
          <el-input v-model="receivableform.customerName" :disabled="true" style="width: 220px"   />
        </el-form-item>
        <el-form-item label="回款日期" prop="returnTime">
          <el-date-picker clearable size="small" style="width: 220px"
            v-model="receivableform.returnTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择回款日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="回款方式" prop="returnType">
           <el-select v-model="receivableform.returnType" placeholder="请选择回款方式" clearable size="small">
              <el-option
                    v-for="dict in receivablesTypeOptions"
                    :key="dict.dictValue"
                    :label="dict.dictLabel"
                    :value="dict.dictValue"
                  />
            </el-select>
        </el-form-item>
        <el-form-item label="回款金额" prop="money">
          <el-input v-model="receivableform.money" type="number" placeholder="请输入回款金额" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="receivableform.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitReceivableForm">确 定</el-button>
        <el-button @click="receivable.open=false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {  addCrmReceivables} from "@/api/crm/receivables";
import { editRate,myListContract,getContract,addContract ,delContract } from "@/api/crm/contract";
import { getMyCustomerUsers  } from "@/api/crm/customerUser";
import { getContactList  } from "@/api/crm/customerContacts";

import { getToken } from "@/utils/auth";
import customer from "../../components/customerDetails";
import contract from "../../components/contractDetails";
import product from '../../components/product.vue';


export default {
  name: "Customer",
  components: { customer,contract, product},
  data() {
    return {
      opStatusOptions:[],
      receivablesTypeOptions:[],
      // 表单参数
      receivableform: {
        customerName:undefined,
      },
      // 表单校验
      receivablerules: {
        code: [
          { required: true, message: "回款编号不能为空", trigger: "blur" }
        ],
        contractId: [
          { required: true, message: "合同不能为空", trigger: "blur" }
        ],
         returnTime: [
          { required: true, message: "回款时间不能为空", trigger: "blur" }
        ],
         returnType: [
          { required: true, message: "回款方式不能为空", trigger: "blur" }
        ],
         money: [
          { required: true, message: "回款金额不能为空", trigger: "blur" }
        ],
      },
      receivable:{
        title:"新增回款",
        open:false
      },
      editRateform:{
        contractId:null,
        rate:0
      },
      editRateRules:{
         rate: [
          { required: true, message: "请输入折算系数", trigger: "blur" }
        ],
      },
      editRate:{
        title:"修改折算系数",
        open:false
      },
      product:{
        title:"新增合同",
        open:false
      },
      contractProducts:[],
      contacts:[],
      contractTypeOptions:[],
      customerUsers:[],
      opform:{},
      oprules:{
        customerId: [
          { required: true, message: "请选择客户", trigger: "blur" }
        ],
        code: [
          { required: true, message: "请输入合同编号", trigger: "blur" }
        ],
        name: [
          { required: true, message: "请输入合同名称", trigger: "blur" }
        ],
        money: [
          { required: true, message: "请输入合同金额", trigger: "blur" }
        ],
        orderDate: [
          { required: true, message: "请选择下单时间", trigger: "blur" }
        ],
        contactsId: [
          { required: true, message: "请选择客户签约人", trigger: "blur" }
        ],
        companyUserId: [
          { required: true, message: "请选择公司签约人", trigger: "blur" }
        ],
        types: [
          { required: true, message: "请选择合同类型", trigger: "blur" }
        ],
        startTime: [
          { required: true, message: "请选择合同开始时间", trigger: "blur" }
        ],
        limitTime: [
          { required: true, message: "请选择合同结束时间", trigger: "blur" }
        ],

        
      },
      opTitle:"",
      opOpen:false,
      customerShow:{
        open:false,
        title:'合同详情'
      },
      contractShow:{
        open:false,
        title:'合同详情'
      },
      statusOptions:[],
      
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 客户表格数据
      contractList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        code:null,
        name:null,
        customerName: null,
        mobile: null,
      },
      form:{
        customerUserId:null,
        customerId:null,
        userId:null,
        isAudit:'0',
        customerName:null,
        userNickName:null,
        createTime:null,
        auditNote:null,

      },
      rules:{}
      
    };
  },
  created() {
    this.getList();
    this.getDicts("contract_status").then((response) => {
      this.statusOptions = response.data;
    });
     this.getDicts("contract_type").then((response) => {
      this.contractTypeOptions = response.data;
    });
    this.getDicts("receivables_type").then((response) => {
      this.receivablesTypeOptions = response.data;
    });
    this.getDicts("contract_op_status").then((response) => {
      this.opStatusOptions = response.data;
    });
     
  },
  mounted() {
   
  },
  methods: {
    submitReceivableForm(){
      this.$refs["receivableform"].validate(valid => {
        if (valid) {
            addCrmReceivables(this.receivableform).then(response => {
              if (response.code === 200) {
                this.msgSuccess("新增回款成功,请等待审核...");
                this.receivable.open = false;
                this.getList();
              }
            });
        }
      });
    },
    handleAddReceivables(row){
      console.log(row)
        this.receivableform={};
        this.receivable.open=true;
        this.receivableform.customerName=row.customerName;
        this.receivableform.contractId=row.contractId;
        this.receivableform.name=row.name;
        this.receivableform.customerId=row.customerId;
    },
    getTotalMoney(){
      this.opform.totalPrice=0;
      this.opform.money=0;
      for(var j=0;j<this.contractProducts.length;j++){
        this.opform.totalPrice+=this.contractProducts[j].subtotal;
        this.opform.money+=this.contractProducts[j].subtotal;
         
      }
      console.log(this.opform.totalPrice);
      this.$forceUpdate();
     
    },
    numberChange(row){
       row.subtotal=row.num*row.salesPrice-row.num*row.salesPrice*row.discount/100;
      this.getTotalMoney();

    },
    discountChange(row){
        row.subtotal=row.num*row.salesPrice-row.num*row.salesPrice*row.discount/100;
        this.getTotalMoney();
    },
    priceChange(row){
      row.subtotal=row.num*row.salesPrice-row.num*row.salesPrice*row.discount/100;
      this.getTotalMoney();

    },
    delProduct(row){
      for(var j=0;j<this.contractProducts.length;j++){
         if(row.productId==this.contractProducts[j].productId){
            this.contractProducts.splice(j,1); 
         }
      }
      this.getTotalMoney();
    },
    updateProduct(data){
      console.log(data);
      this.product.open=false;
      for(var j=0;j<data.length;j++){
        var flag=true;
         for(var i=0;i<this.contractProducts.length;i++){
            if(data[j].productId==this.contractProducts[i].productId){
             
              flag=false;
              continue;
            }
          }
          if(flag){
             var item={};
             item.salesPrice=data[j].price;
             item.productId=data[j].productId;
             item.name=data[j].name;
             item.price=data[j].price;
             item.cateName=data[j].cateName;
             item.unit=data[j].unit;
             item.num=1;
             item.discount=0;
             item.subtotal=data[j].price;
          
             this.contractProducts.push(item)
          }
      }
      this.getTotalMoney();
    },
    openProduct(){
      this.product.open=true;
    },
    editRateSubmitForm(){
      this.$refs["editRateform"].validate(valid => {
        if (valid) {
            this.opform.products=this.contractProducts;
            editRate(this.editRateform).then(response => {
              if (response.code === 200) {
                this.msgSuccess("修改成功");
                this.editRate.open = false;
                this.getList();
              }
            });
        }
      });
    },
    addSubmitForm(){
        this.$refs["opform"].validate(valid => {
        if (valid) {
            // if(this.contractProducts.length==0){
            //   this.$message({
            //     message: '请选择产品',
            //     type: 'warning'
            //   });
            //   return;
            // }
            this.opform.products=this.contractProducts;
            addContract(this.opform).then(response => {
              if (response.code === 200) {
                this.msgSuccess("新增成功");
                this.opOpen = false;
                this.getList();
              }
            });
        }
      });
    },
    customerSelectChange(val){
      console.log(val);
      this.opform.customerUserId=val;
      for(var i=0;i<this.customerUsers.length;i++){
        if(this.customerUsers[i].customerUserId==val){
            this.opform.customerId=this.customerUsers[i].customerId;
            var data={customerId:this.customerUsers[i].customerId};
            getContactList( data).then(response => {
              this.contacts = response.list;
            });
        }
      }
     
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      console.log(row);
      const contractIds = row.contractId || this.ids;
      this.$confirm('是否确认删除合同编号为"' + contractIds + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delContract(contractIds);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(function() {});
    },
    handleAdd(){
      this.opOpen = true;
      this.opTitle = "新增合同";
      getMyCustomerUsers( ).then(response => {
        this.customerUsers = response.list;
         
      });
    },
    openCustomer(row){
      
      this.customerShow.open=true;
      const customerId = row.customerId || this.ids
      setTimeout(() => {
        this.$refs.customer.getCustomerDetails(customerId);
      }, 500);
    },
    handleShow(row) {
      this.contractShow.open=true;
      const contractId = row.contractId || this.ids
      setTimeout(() => {
        this.$refs.contract.getContract(contractId);
      }, 500);
      
    },
    handleEditRate(row){
         this.editRate.open=true;
         this.editRateform.contractId=row.contractId;
         this.editRateform.rate=row.rate;
    },
    /** 查询客户列表 */
    getList() {
      this.loading = true;
      myListContract(this.queryParams).then(response => {
        this.contractList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
     
     
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.contractId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    
  }
};
</script>
<style>
 
 .money{
      color: red;
  }
</style>

